/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.uniminuto.edu.videominuto.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Juan
 */
@Entity
@Table(name = "coleccion")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Coleccion.findAll", query = "SELECT c FROM Coleccion c"),
    @NamedQuery(name = "Coleccion.findByIsan", query = "SELECT c FROM Coleccion c WHERE c.isan = :isan"),
    @NamedQuery(name = "Coleccion.findByIdColeccion", query = "SELECT c FROM Coleccion c WHERE c.idColeccion = :idColeccion"),
    @NamedQuery(name = "Coleccion.findByTitColeccion", query = "SELECT c FROM Coleccion c WHERE c.titColeccion = :titColeccion"),
    @NamedQuery(name = "Coleccion.findByVolColeccion", query = "SELECT c FROM Coleccion c WHERE c.volColeccion = :volColeccion")})
public class Coleccion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 90)
    @Column(name = "isan")
    private String isan;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_coleccion")
    private Integer idColeccion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 90)
    @Column(name = "tit_coleccion")
    private String titColeccion;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 90)
    @Column(name = "vol_coleccion")
    private String volColeccion;
    @ManyToMany(mappedBy = "coleccionList")
    private List<Video> videoList;

    public Coleccion() {
    }

    public Coleccion(Integer idColeccion) {
        this.idColeccion = idColeccion;
    }

    public Coleccion(Integer idColeccion, String isan, String titColeccion, String volColeccion) {
        this.idColeccion = idColeccion;
        this.isan = isan;
        this.titColeccion = titColeccion;
        this.volColeccion = volColeccion;
    }

    public String getIsan() {
        return isan;
    }

    public void setIsan(String isan) {
        this.isan = isan;
    }

    public Integer getIdColeccion() {
        return idColeccion;
    }

    public void setIdColeccion(Integer idColeccion) {
        this.idColeccion = idColeccion;
    }

    public String getTitColeccion() {
        return titColeccion;
    }

    public void setTitColeccion(String titColeccion) {
        this.titColeccion = titColeccion;
    }

    public String getVolColeccion() {
        return volColeccion;
    }

    public void setVolColeccion(String volColeccion) {
        this.volColeccion = volColeccion;
    }

    @XmlTransient
    public List<Video> getVideoList() {
        return videoList;
    }

    public void setVideoList(List<Video> videoList) {
        this.videoList = videoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idColeccion != null ? idColeccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Coleccion)) {
            return false;
        }
        Coleccion other = (Coleccion) object;
        if ((this.idColeccion == null && other.idColeccion != null) || (this.idColeccion != null && !this.idColeccion.equals(other.idColeccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.uniminuto.edu.videominuto.entities.Coleccion[ idColeccion=" + idColeccion + " ]";
    }
    
}
